package com.eastfair.venuebooking.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 展会
 * </p>
 *
 * @author linan
 * @date 2023-03-22
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ExhibitionExhibitionNatureEnum", description = "展会性质 #{GOVERNMENT:政府展;BUSINESS:商业展;CONSUMPTION:消费展;TRADE:贸易展;OTHER:其他-枚举")
public enum ExhibitionExhibitionNatureEnum implements BaseEnum {

    /**
     * GOVERNMENT="政府展"
     */
    GOVERNMENT("政府展"),
    /**
     * BUSINESS="商业展"
     */
    BUSINESS("商业展"),
    /**
     * CONSUMPTION="消费展"
     */
    CONSUMPTION("消费展"),
    /**
     * TRADE="贸易展"
     */
    TRADE("贸易展"),
    /**
     * OTHER="其他"
     */
    OTHER("其他"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static ExhibitionExhibitionNatureEnum match(String val, ExhibitionExhibitionNatureEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static ExhibitionExhibitionNatureEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(ExhibitionExhibitionNatureEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "GOVERNMENT,BUSINESS,CONSUMPTION,TRADE,OTHER", example = "GOVERNMENT")
    public String getCode() {
        return this.name();
    }

}
